
package src.origintrail;

/**
 * An instance of buying an object.
 * @author csmythe
 */
public class EventBuy extends Event{
    /**
     * Which item is added
     */
    public Item added;
    
    /**
     * The constructor
     * @param i Which item is bought
     */
    public EventBuy(Item i){
        added = i;
    }
    @Override
    public void activate(){
        OriginTrail.plr.bags.addItem(added);
        OriginTrail.plr.bags.addItem((new Money()).initialize((int)((-added.getStack() * added.getValue()) * (1.0 + OriginTrail.plr.getMap().distanceTraveled()/1000.0))));
        ((Wagon)OriginTrail.plr.bags.find(new Wagon())).addMassHeld(added.getWeight()*added.getStack());
    }
}
